<template>
  <!-- 二次确认 -->
  <a-modal title="操作记录" v-model:visible="visible" width="80vw" unmount-on-close>
    <operate-log v-bind="$attrs" :id="logId" />
    <template #footer>
      <a-button @click="close">关闭</a-button>
    </template>
  </a-modal>
</template>

<script setup>
  import { ref } from 'vue'

  const props = defineProps({
    // 业务id
    id: [String, Number],
  })

  const logId = ref(props.id)

  const visible = ref(false)
  /**
   * 弹窗开启
   * @param id 业务id
   */
  const open = (id) => {
    if (id) logId.value = id
    visible.value = true
  }
  const close = () => {
    visible.value = false
  }

  defineExpose({ open })
</script>
